package com.lzy.system.business.dto;

import com.lzy.validator.StringMinMaxConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * <p>
 * 存储表
 * </p>
 *
 * @author lcc
 * @since 2024-01-21
 */
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "SysBusEntity新增dto", description = "存储表")
@Valid
public class SysBusEntityAddDTO {
    @ApiModelProperty("存储标题")
    @StringMinMaxConstraint(min = 1, max = 100, message = "存储标题长度必须在0-100之间")
    private String title;

    @ApiModelProperty("存储表名称")
    @StringMinMaxConstraint(min = 1, max = 100, message = "存储表名称长度必须在0-100之间")
    @Pattern(regexp = "^[a-z_]+$", message = "只能输入小写英文字母和下划线")
    private String name;

    @ApiModelProperty("排序")
    private Integer order_index;

    @ApiModelProperty("业务模型id")
    @StringMinMaxConstraint(min = 1, max = 32, message = "业务模型id长度必须在0-32之间")
    private String bus_id;

    @NotNull(message = "至少要添加一个字段")
    @Valid
    private List<SysBusEntityFieldAddDTO> fieldList;
}
